// backend/src/models/device.js
const mongoose = require('mongoose');

const deviceSchema = new mongoose.Schema({
    deviceId: { type: String, required: true, unique: true },
    name: { type: String },
    type: { type: String },
    status: {
        connected: { type: Boolean, default: false },
        lastSeen: { type: Date },
        batteryLevel: { type: Number },
        error: { type: String }
    },
    configuration: {
        ip: String,
        port: Number,
        features: [String]
    }
});

module.exports = mongoose.model('Device', deviceSchema);
